/*
 * author : Dinh Ngoc Tuan Vu (A0092633)
 */
package sg.edu.nus.iss.team4ft.service;

import java.io.IOException;
import java.io.Serializable;
import java.util.Date;

import sg.edu.nus.iss.team4ft.util.AppConstant;

public class DataService extends Feature  implements Serializable  {

	private static final long serialVersionUID = 1L;

	public DataService(Date startDate, Plan plan) throws IOException {
		super(startDate, FeatureCode.DataService);
		super.setServiceName(AppConstant.DATA_SERVICE_FEATURE);
		setPlan(plan);
		if(getPlan() != null)
		{		
			Double d = 0.0;
			try {
				d = new RateTable().getSubscriptionCharge(getPlan().getPlanCode(), FeatureCode.DataService);
			} catch (IOException e) {
				throw e;
			}
			setSubscriptionCharge(d);
		}
	}

	private DataService(DataService dataService) throws CloneNotSupportedException {
		super(dataService);
	}

	@Override
	public DataService clone() throws CloneNotSupportedException {
		// TODO Auto-generated method stub
		return new DataService(this);
	}
}
